﻿using System;
using System.Collections.Generic;
using System.Data;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class control_chitiettour_InfoChiTietTour : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

        }
    }
    protected string GetNameDiaDiemById(long id)
    {
        DataTable dt = DataAccess.ExeSQLToDataTable("select Name from DiaDanh where IdYahoo = '" + id + "'");
        if (dt.Rows.Count == 0)
        {
            return "";
        }
        else
        {
            return dt.Rows[0][0] == null ? "" : dt.Rows[0][0].ToString();
        }

    }
    protected string GetInfoDatTour()
    {
        string htmlCode = "";
        long idTour = Convert.ToInt64(Request.QueryString.Get("id"));
        //string link_web = "?menu=" + (idMenu == 0 ? 161 : idMenu) + "&parent=" + (idParent == 0 ? 0 : idParent) + "";
        DataTable tbl =
            DataAccess.ExeSQLToDataTable("select * from dev_news where checktour=1 and status = 1 and idnews = '" + idTour + "' order by idnews desc");

        if (tbl.Rows.Count > 0)
        {
            htmlCode = @"<div class='btn_Xemchitiet'>
                            <div class='style_like_face'>
                                <div class='fb-like' data-href='http://lanhdaitourist.com/chitiettourdulich.aspx?id=" + tbl.Rows[0]["idnews"] + @"' data-send='true' data-layout='button_count'
                                    data-show-faces='true'>
                                </div>
                            </div>
                            <a class='style_btnDattour' href='dattourdulich.aspx?id=" + tbl.Rows[0]["idnews"] + @"'>Đặt tour</a>
                        </div>";
        }

        return htmlCode;
    }

    protected string GetInfoSketTour()
    {
        string htmlCode = "";
        long idTour = Convert.ToInt64(Request.QueryString.Get("id"));
        //string link_web = "?menu=" + (idMenu == 0 ? 161 : idMenu) + "&parent=" + (idParent == 0 ? 0 : idParent) + "";
        DataTable tbl = DataAccess.ExeSQLToDataTable("select * from dev_news where checktour=1 and status = 1 and idnews = '" + idTour + "' order by idnews desc");

        if (tbl.Rows.Count > 0)
        {
            htmlCode += @"<div class='img-daidien_tour'>
                        <img src='files_upload/images/pictour/" + tbl.Rows[0]["picture"] + @"' />
                    </div>
                    <div class='noidung_tour_short'>
                        <div class='name_tour'>
                            <a href='#'><b>" + ITNLip.CatChuoi(tbl.Rows[0]["title"].ToString(), 80) + @"</b></a>
                        </div>
                        <div class='list_info_tour'>
                            <ul>
                                <li>
                                    <b>Điểm xuất phát: </b><a>" + GetNameDiaDiemById(Convert.ToInt64((tbl.Rows[0]["diemxuatphat"] == null ? "0" : tbl.Rows[0]["diemxuatphat"]))) + @"</a>
                                </li>
                                <li>
                                    <b>Điểm đến: </b><a>" + GetNameDiaDiemById(Convert.ToInt64((tbl.Rows[0]["diemden"] == null ? "0" : tbl.Rows[0]["diemden"]))) + @"</a>
                                </li>
                                <li>
                                    <b>Thời gian: </b><a>" + LoadInfoThoigian((Convert.ToInt64(tbl.Rows[0]["thoigian"] == null ? "0" : tbl.Rows[0]["thoigian"]))) + @"</a>
                                </li>
                                <li>
                                    <b>Phương tiện: </b><a>" + tbl.Rows[0]["phuongtien"] + @"</a>
                                </li>
                                <li>
                                    <b>Giá tour: </b><a class='giakm'>" + String.Format("{0:0,0}", (tbl.Rows[0]["giatour"] == null ? "" : tbl.Rows[0]["giatour"])) + " VNĐ" + @"</a>
                                </li>
                                <li>
                                    <b>Hotline: </b><a class='style_a_hotline'>" + tbl.Rows[0]["hotline"] + @"</a>
                                </li>                                
                            </ul>
                        </div>
                    </div>";
        }
        return htmlCode;
    }
    protected string GetInfoPriceTourInclude()
    {
        string htmlCode = "";
        long idTour = Convert.ToInt64(Request.QueryString.Get("id"));
        //string link_web = "?menu=" + (idMenu == 0 ? 161 : idMenu) + "&parent=" + (idParent == 0 ? 0 : idParent) + "";
        DataTable tbl =
            DataAccess.ExeSQLToDataTable("select * from dev_news where checktour=1 and status = 1 and idnews = '" + idTour + "' order by idnews desc");
        if (tbl.Rows.Count > 0)
        {
            htmlCode += tbl.Rows[0]["giavebaogom"];
        }
        return htmlCode;
    }
    protected string LoadInfoThoigian(long id)
    {
        string result = "";
        DataTable list =
           DataAccess.ExeSQLToDataTable("select Name from Ngay where IdDuLich=" + id + "");
        if (list.Rows.Count > 0)
        {
            result = list.Rows[0][0].ToString();
        }
        return result;
    }
    protected string GetInfoPriceTourExclude()
    {
        string htmlCode = "";
        long idTour = Convert.ToInt64(Request.QueryString.Get("id"));
        //string link_web = "?menu=" + (idMenu == 0 ? 161 : idMenu) + "&parent=" + (idParent == 0 ? 0 : idParent) + "";
        DataTable tbl =
            DataAccess.ExeSQLToDataTable("select * from dev_news where checktour=1 and status = 1 and idnews = '" + idTour + "' order by idnews desc");
        if (tbl.Rows.Count > 0)
        {
            htmlCode += tbl.Rows[0]["giavekhongbaogom"];
        }
        return htmlCode;
    }
    protected string GetInfoContent()
    {
        string htmlCode = "";
        long idTour = Convert.ToInt64(Request.QueryString.Get("id"));
        //string link_web = "?menu=" + (idMenu == 0 ? 161 : idMenu) + "&parent=" + (idParent == 0 ? 0 : idParent) + "";
        DataTable tbl =
            DataAccess.ExeSQLToDataTable("select * from dev_news where checktour=1 and status = 1 and idnews = '" + idTour + "' order by idnews desc");
        if (tbl.Rows.Count > 0)
        {
            htmlCode += tbl.Rows[0]["body"];
        }
        return htmlCode;
    }
    protected string GetNameTourDuLich()
    {
        string htmlCode = "";
        long idTour = Convert.ToInt64(Request.QueryString.Get("id"));
        //string link_web = "?menu=" + (idMenu == 0 ? 161 : idMenu) + "&parent=" + (idParent == 0 ? 0 : idParent) + "";
        DataTable tbl =
            DataAccess.ExeSQLToDataTable("select * from dev_news where checktour=1 and status = 1 and idnews = '" + idTour + "' order by idnews desc");
        if (tbl.Rows.Count > 0)
        {
            htmlCode += ITNLip.CatChuoi(tbl.Rows[0]["title"].ToString(), 60);
        }
        return htmlCode;
    }
}